

local w,h = 100,25
function work_load(unit)
    local panel = class.panel:builder
    {
        x = -800,
        y = -200,
        w = w,
        h = h,
        is_show = false,
        world_auto_remove = false,
        world_anchor = 'bottom',
        normal_image = [[core\hpbar\backdrop-hero.tga]],
        update = function(self)
            local unit = self.world_widget
            if not unit then
                return
            end
            local rate1 = ac.player.self:get_data('炮弹进度',0)
            local rate2 = (1 - unit.work_timer:get_remaining()/1000)

            self.life:set_width(self.life_w*rate1+0.01)
            self.cost:set_width(self.cost_w*rate2+0.01)

            local title = ('%s(%s/%s)'):format(unit:get_name(),num,max)
            if self.title.text~=title then
                self.title:set_text(title)
            end
        end,
    }

    panel.title = panel:add_text('',-2,-15,w,10,8,5)
    panel.life = panel:add_panel([[core\hpbar\ShieldBar.tga]],2,3,w-10,11)
    panel.life:add_panel([[core\hpbar\Line.tga]])
    panel.cost = panel:add_panel([[core\hpbar\黄条.tga]],2,17,w-10,3)

    panel.life_w = panel.life.w
    panel.cost_w = panel.cost.w
    panel:hide()

    panel:bind_world(unit)
    japi.SetUnitPressUIVisible(unit.handle,false)

    ac.hardware:on "界面绘制" (function ()
        panel:update()
    end)
end
